<?php
    use User\Model\RedPacketModel;
?>
<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">中奖管理</h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <a style="margin-left:7px" href="/User/RedPacket/index" class="btn btn-default">返回</a>
                    <button style="float:right" type="button" onclick="return download();" class="btn btn-info">导出</button>
                </div>
                <!-- /.panel-heading -->

                <div class="panel-body">
                    <div class="col-lg-12">
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>姓名</th>
                                    <th>联系方式</th>
                                    <th>奖项等级</th>
                                    <th>奖项名称</th>
                                    <th>是否中奖</th>
                                    <th>参与时间</th>
                                    <!--<th class="textAlignCenter">操作</th>-->
                                </tr>
                                </thead>
                                <tbody>
                                <volist name="list" id="item">
                                    <tr>
                                        <td>{$item.id}</td>
                                        <td>{$fans[$item['openid']]['name']}</td>
                                        <td>{$fans[$item['openid']]['phone']}</td>
                                        <td>{$award[$item['award_id']]['award_level']}</td>
                                        <td>{$award[$item['award_id']]['award_name']}</td>
                                        <td>
                                            <if condition="$item.zhongjiang eq RedPacketModel::ZHONGJIANG_ACTIVE">
                                                <span class="label label-success">中奖</span>
                                            <else/>
                                                <span class="label label-warning">未中奖</span>
                                            </if>
                                        </td>
                                        <td>{$item.createdate}</td>
                                        <!--<td>-->
                                            <!--<a href="{:U('User/RedPacket/edit', array('id'=>$item['id']))}" title="编辑活动" class="btn btn-default"><i class="fa fa-edit"></i></a>-->
                                        <!--</td>-->
                                    </tr>

                                </volist>

                                </tbody>
                            </table>


                        </div>
                        <!-- /.table-responsive -->

                        <div class="pages">
                            {$page}
                        </div>
                    </div>
                    <!-- / .col-lg-12 -->
                </div>
                <!-- / .panel-body -->
            </div>
            <!-- /.panel-body -->
        </div>
        <!-- /.panel -->
    </div>
    <!-- /.col-lg-12 -->
</div>

</div>
<script>
    function download(){
        var id = '<?php echo $id; ?>';
        window.location = '/User/RedPacket/exportAwards?id=' + id;
        return false;
    }
</script>